package com.ludomancy.archeologyrpg.entities;

import java.awt.Graphics;
import java.awt.Point;

import com.ludomancy.archeologyrpg.Entity;
import com.ludomancy.archeologyrpg.Game;

public class Nest extends Entity
{
	private static final int SPAWN_TIME = Game.discretize(1500);
	private static final int MAX_SPAWNS = 3;
	private int spawns = 0;
	private int spawnTime = 0;
	private int spawnSpeed = Game.discretize(20);
	
	public Nest(Point p)
	{
		super(p);
	}
	
	public void paint(Graphics g, int x, int y)
	{
		paintDefaultIcon(g, ALIEN_FUNGUS_SPAWNER, x, y);
	}
	
	public void update(boolean running, boolean activated)
	{
		if(running)
		{
			if(spawns < MAX_SPAWNS)
			{
				spawnTime += spawnSpeed;
				if(spawnTime > SPAWN_TIME)
				{
					spawnTime = 0;
					spawns++;
//					Game.game.entities.add(new Fungus(new Point(px, py), this));
				}
			}
		}
	}

	public void paintInfo(Graphics g)
	{
	}

	public String getActionVerb()
	{
		return "?";
	}

	public void onSpawnKilled(Fungus fungus)
	{
		spawns--;
	}
}
